<template>
  <div class="personal-info">
    <div class="info">
        <group>
            <div class="avatar-edit" @click="linkToCertificate">
                <cell title="头像" >
                    <div class="info-item avatar"><img :src="infoObj.images&&infoObj.images.length>0?infoObj.images[0].fileUrl:'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3987166397,2421475227&fm=27&gp=0.jpg'" alt=""></div>
                </cell>
            </div>
            <div class="info-list">
                <div @click="linkToCertificate" class="weui-cell after box box-align-center box-pack-between">
                    <div class="cell-name">姓名</div>
                    <div class="cell-content">{{infoObj.trueName?infoObj.trueName:infoObj.userName}}</div>
                </div>
                <div class="weui-cell box  box-align-center box-pack-between">
                    <div class="cell-name">性别</div>
                    <div class="cell-content">{{infoObj.sex?sexArr[infoObj.sex]:'未知'}}</div>
                </div>
                <div @click="linkTo" class="weui-cell after box box-align-center box-pack-between">
                    <div class="cell-name">{{infoObj.registerType=='mobile'?'手机号':'邮箱账号'}}</div>
                    <div class="cell-content">{{infoObj.registerType=='mobile'?infoObj.mobile:infoObj.email}}</div>
                </div>
                <div class="weui-cell box box-align-center box-pack-between">
                    <div class="cell-name">微信</div>
                    <div class="cell-content">{{infoObj.weixinUserNickname}}</div>
                </div>
                <div class="weui-cell address box box-align-center box-pack-between">
                    <div class="cell-name">所在地区</div>
                    <div class="cell-content">{{infoObj.province}}{{infoObj.city}}{{infoObj.district}}</div>
                </div>
                <div class="weui-cell box box-align-center box-pack-between">
                    <div class="cell-name">平台认证身份</div>
                    <div class="cell-content">{{dutyStr(infoObj.duty)}}</div>
                </div>
            </div>
        </group>
    </div>
  </div>
</template>

<script>
import { Group, Cell,XInput} from 'vux'
let CONSTANT = require('../../../wechat/static/constant/constant.js'),
    common = require("../../../wechat/static/common/common.js"),
    wsService = require("../../../wechat/static/common/wechat-jsdk.js");
export default {
  components: {
      Group,
      Cell,
      XInput
  },
  data () {
    return {
        infoObj:'',
        sexArr:['女','男'],
        addressArr:[],
        identifyList: [
          {key: "doctor", value:"医生"},{key: "nurse", value:"护士"},{key: "recover_physical_therapist", value:"康复理疗师"},
          {key: "health_manager", value:"健康管理师"},{key: "apothecary", value:"药师"},{key: "hospital ", value:"医院"},{key: "clinic", value:"诊所"},
          {key: "drugstore", value:"药店"},{key: "medical_instrument_supplie", value:"医疗器械供应商"},
        ],
    }
  },
  created(){
    this.getInfo()
  },
  mounted(){

  },
  methods:{
    onChange(val){

        this.sex = val[0] == '男'?1:0
        console.log(this.sex)
    },
    dutyStr(e){
        let str;
        this.identifyList.forEach((item)=>{
            if(item.key == e){
                str = item.value
            }
        })
        return str;
      },
    Datechange(str){
        console.log(str);
    },
    onConfirm(){

    },
    getInfo(){
        let  url = CONSTANT.URL.DOCTOR.DETAIL,
            param = {}
        common.requestAjax(url,{},param,(res)=>{
            if(res.status == 200){
                let data = res.data.bussData;
                this.infoObj = data;
                this.addressArr[0] = data.province;
                this.addressArr[1] = data.city;
                this.addressArr[2] = data.district;
                console.log(this.addressArr)
            }else{

            }
        })
    },
    linkToCertificate() {
      this.$router.push({path: "/certificateEdit"})
    },
    linkTo(link){
         this.$router.push({ path: 'bindMobile', query: { type: this.infoObj.registerType }})       
    },

  }
}
</script>

<style lang="scss">
    .personal-info{
        height: 98%;
        background-color: #f4f4f4;
        padding-top: 5%;
        font-size: .3rem;
        color: #111;
        .weui-cells .address .weui-cell_access .weui-cell__ft:after{
            width: 0;
            height: 0;
            display: none;
        }
        .weui-dialog__btn_primary{
            background-color: #69B147;
            color: #fff;
         }
         .avatar-edit{
             position: relative;
             margin-bottom: .31rem;
             background-color: #fff;
              &:after{
                content:'';
                position: absolute;
                right: .3rem;
                top: .66rem;
                width: .2rem;
                height:.2rem;
                border-top: 1px solid #999;
                border-right: 1px solid #999;
                -webkit-transform: rotate(45deg);
             }
             .weui-cell{
                height: 1.58rem!important;
                padding: 0 .3rem;
             }
         }
         .info-list{
             background-color: #fff;
         }
         .weui-cells{
             margin-top: 0;
             background-color: #f4f4f4;
             .weui-cell_access .weui-cell__ft:after{
                border-width: 1px 1px 0 0;
                width: .2rem;
                border-color:#999;
                height:.2rem;
                top: 0rem;
             }
             .weui-cell{
                 padding: 0 .3rem;
                 height: .88rem;
             }
             .cell-name{
                 color:#111;
             }
             .cell-content{
                 position: relative;
                 color: #666;
             }
            .after{
                .cell-content{
                    padding-right: .33rem;
                    position: initial;
                    &:after{
                        content:'';
                        position: absolute;
                        right: .3rem;
                        top: .34rem;
                        width: .2rem;
                        height:.2rem;
                        border-top: 1px solid #999;
                        border-right: 1px solid #999;
                        -webkit-transform: rotate(45deg);
                    }
                }
            }
         }
         .weui-dialog__btn_default{
             display: none;
         }
        .weui-dialog__hd{
            padding: 0rem;
            height: .8rem;
            text-align: left;
            line-height: .8rem;
            .weui-dialog__title{
                font-size: .3rem;
                font-weight: normal;
                height: .8rem;
                padding-left: .37rem;
                text-align: left;
                line-height: .8rem;
                display: block;
            }
        }
        .weui-dialog__bd:first-child{
            padding: 1rem .36rem .3rem;
        }
        .weui-cells{
            font-size: .34rem;
            color: #666;
        }
        .vux-cell-value{
            color: #666;
        }
        .weui-dialog__bd{
            padding: 1rem .36rem .3rem;
            .dialog-delete{
                position: absolute;
                right: 0px;
                top: 0px;
                width: 50px;
                height: 40px;
            }
            input{
               width: 4.95rem;
               height: 0.8rem;
               margin-top: 0.3rem;
               font-size: 0.26rem;
               padding-left: .3rem;
               border: 0px;
               background-color: #e7e7e7;
            }
        }
        .weui-dialog__ft{
            height: 0.8rem;
            line-height: .8rem;
            font-size: .3rem;
        }
        .delete{
            position: absolute;
            right: 15px;
            top: 13px;
            display: inline-block;
            width: 1px;
            height:12px;
            background: #666;
            line-height: 0;
            font-size:0;
            vertical-align: middle;
            -webkit-transform: rotate(45deg);
            &:after{
                content:'/';display:block;width: 1px;height:12px; background: #666;-webkit-transform: rotate(-90deg);
            }
        }
        .info{
            .info-item { width:1.03rem;height: 1.03rem;padding-right: .32rem}
            img{ width:1.03rem;height: 1.03rem;border-radius: 50%;}
            .weui-input{color: #999; }
            .calendar-title{
                font-size: 12px;
            }
            .selected-days {
                color: #999;
                width: 90px;
            }
        }
        .tips{
            background-color: #f4f4f4;
            padding:0.6rem 0.3rem 0;
            p{
                position: relative;
                color: #c6c6c6;
                font-size: 0.3rem;
                padding-left: 0.2rem;
                span{
                    position: absolute;
                    left: 0;
                    top:0.05rem;
                    display: block;
                }
            }
            button{
                position: relative;
                top: -.3rem;
                width: 80%;
                height:0.8rem;
                margin: 0rem 10% 0rem;
                border:none;
                background-color: #69b147;
                color: #fff;
                font-size: 0.3rem;
            }
        }

    }
</style>
